package com.muyu.common.config;

import com.muyu.common.result.Result;
import lombok.extern.log4j.Log4j2;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * @Author: DongZeLiang
 * @date: 2024/5/24
 * @Description: 异常处理器
 * @Version: 1.0
 */
@Log4j2
@RestControllerAdvice
public class ExceptionHandler {

    @org.springframework.web.bind.annotation.ExceptionHandler(value = RuntimeException.class)
    public Result<String> runtimeExceptionHandler(RuntimeException e) {
        log.error("程序请求异常:[{}]",e.getMessage(), e);
        return Result.error(e.getMessage());
    }
}
